const {Sequelize} = require('sequelize');
const {sequelize}=require('./common/dbconnection')

// 方法 3: 分别传递参数 (其它数据库)
// const sequelize = new Sequelize('webtest', 'root', 'root', {
//     host: 'localhost',
//     dialect: 'mysql',/* 选择 'mysql' | 'mariadb' | 'postgres' | 'mssql' 其一 */
//     logging: (...msg) => console.log(msg) /*开启日志*/
// });

const User = sequelize.define('user', {
        userId: {
            type: Sequelize.INTEGER,
            primaryKey: true,
            autoIncrement: true,
            comment: "自增id"
        },
        userName: {
            type: Sequelize.STRING
        },
        userPassword: {
            type: Sequelize.STRING
        }
    },
    {
        tableName: "user",
        timestamps:false
    }
    ) //第三个参数来设定数据库表名 防止框架 加个s 如users ，设置时间错，否则在查询时候会添加updateAt 字段 也可以在查询时候指定attribute属性 就不会报错


module.exports = {sequelize, User};